<template>
	<scroll-view class="uni-node" :show-scrollbar="false" scroll-x>
		<template v-for="item in answerItem">
			<view class="view" :class="[questionDoRightTag(item.doRight),currentItemOrder == item.itemOrder?'currentActive':'']" @click="goAnchor(item.itemOrder)">{{item.itemOrder +1 }}</view>
		</template>
	</scroll-view>		
</template>

<script>

	export default {
		props:{
			//题目节点
			answerItem:{
				type: Array,
				default: function () {
				    return []
				}
			},
			currentItemOrder:{
				type: Number,
				default: 0
			}
		},
		data(){
			return {
				leftNum: 10
			}
		},
		methods: {
			//判断题目是否正确
			questionDoRightTag(status){
				console.log(status);
				if( status == null){ //还未判分
					return 'nullActive';
				}else if(status){ //正确
					 return 'successActive';
				}else{  //错误
					return 'failActive';
				}
			},
			//节点事件
			goAnchor(selector){
				console.log(selector);
				this.$emit("goAnswerArc",selector);
			}
		}
		
	}
</script>

<style lang="scss">
.uni-node{
	white-space: nowrap;
	margin-top: 30rpx;
	width: 92%;
	.successActive {
		background: rgba(102,187,106,0.5);
		color: #fff;
		font-weight: bold;
	}
	.failActive{
		background: #FCEFDB;
		color: #66BB6A;
	}
	.nullActive{
		background: #fff;
		color: #66BB6A;
	}
	.currentActive{
		background: #66BB6A;
		color: #fff;
	}
	.view{
		display: inline-block;
		width: 80rpx;
		height: 80rpx;
		text-align: center;
		line-height: 80rpx;
		border-radius: 20rpx;
		border:2rpx solid var(--themeColor);
		margin-right: 20rpx;
		
	}
}
</style>
